<?php
$strOption = $_GET['op'];
if ($strOption == 'friend_select_ui') {
	
	$strBody = file_get_contents('./ajax_friend_select.html');	
	//ajaxXmlOut($strBody);
	echo $strBody;
		
} elseif ($strOption == 'friend_select_data') {
	
	$arrFriend = array();
	$arrFriend['group'][] = array(1, '现在同事');
	$arrFriend['group'][] = array(2, '以前同事');
	$arrFriend['group'][] = array(3, '大学同学');
	$arrFriend['group'][] = array(4, '高中同学');
	$arrFriend['group'][] = array(5, '家人亲戚');
	$arrFriend['group'][] = array(6, '挚交好友');
	$arrFriend['group'][] = array(7, '普通朋友');
	$arrFriend['group'][] = array(8, '朋友的朋友');
	$arrFriend['group'][] = array(9, '其他');

	$arrFriend['friend'][] = array(117611, 1, '田海深', 'tianhaishen', 'ths');
	$arrFriend['friend'][] = array(117601, 2, '唐小飞', 'tangxiaofei', 'txf');
	$arrFriend['friend'][] = array(117602, 3, '崔鹏', 'chuipeng', 'cp');
	$arrFriend['friend'][] = array(117603, 1, '袁维', 'tuanwei', 'yw');
	$arrFriend['friend'][] = array(117604, 2, '曾昕旭', 'thenxixu', 'zxx');
	$arrFriend['friend'][] = array(117605, 1, '张溥峰', 'thangbofong', 'zbf');
	$arrFriend['friend'][] = array(117612, 2, '郑瑛', 'thenying', 'zy');
	$arrFriend['friend'][] = array(117607, 1, '何佳建', 'tejiajian', 'hjj');
	$arrFriend['friend'][] = array(117608, 8, '李力', 'tili', 'll');
	$arrFriend['friend'][] = array(117609, 1, '刘立猛','tiukimong', 'llm');
	$arrFriend['friend'][] = array(117610, 1, '吕晓磊', 'tuxiaolei', 'lxl');
	
	$arrFriend['friend'][] = array(117901, 1, '紫藤木马', 'tuxiaolei', 'ztmm');
	$arrFriend['friend'][] = array(117402, 1, '田克山', 'tuxiaolei', 'tks');
	$arrFriend['friend'][] = array(117406, 1, '杨帆', 'tuxiaolei', 'yf');
	$arrFriend['friend'][] = array(117408, 1, '李妍', 'tuxiaolei', 'ly');
	$arrFriend['friend'][] = array(117909, 1, '邱岳', 'tuxiaolei', 'qy');
	$arrFriend['friend'][] = array(117908, 1, '许海鸥', 'tuxiaolei', 'xho');
	$arrFriend['friend'][] = array(117906, 1, '戎一人', 'tuxiaolei', 'jyr');
	$arrFriend['friend'][] = array(117904, 1, '黄子雄', 'tuxiaolei', 'hzx');
	
	echo json_encode($arrFriend);
	
} elseif ($strOption == 'friend_list') {
	
	$iPage = getGET('page', 1);
	
	$arrFriend = array();
	$arrFriend['page'] = array('num'=>80, 'size'=>20);
	$arrFriend['friend'][] = array(117611, '田海深', '广东-深圳');
	$arrFriend['friend'][] = array(117601, '唐小飞', '广东-深圳');
	$arrFriend['friend'][] = array(117602, '崔鹏', '广东-深圳');
	$arrFriend['friend'][] = array(117603, '袁维', '广东-深圳');
	$arrFriend['friend'][] = array(117604, '曾昕旭', '广东-深圳');
	$arrFriend['friend'][] = array(117605, '张溥峰', '广东-深圳');
	$arrFriend['friend'][] = array(117612, '郑瑛', '广东-深圳');
	$arrFriend['friend'][] = array(117607, '何佳建', '广东-深圳');
	$arrFriend['friend'][] = array(117608, '李力', '广东-深圳');
	$arrFriend['friend'][] = array(117609, '刘立猛', '广东-深圳');
	$arrFriend['friend'][] = array(117610, '吕晓磊', '广东-深圳');
	
	echo json_encode($arrFriend);
} 

/**
 * ajax 返回xml格式的数据
 *
 * @param string $content
 */
function ajaxXmlOut($content, $ext='')
{
	@header("Expires: -1");
	@header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
	@header("Pragma: no-cache");
	@header("Content-type: application/xml; charset=utf-8");
	echo '<'."?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
	if (empty($ext)) {
		echo "<root><![CDATA[".$content."]]></root>\n";
	} else {
		echo "<root><result><![CDATA[".$content."]]></result>{$ext}</root>\n";
	}
	exit();
}
?>